/**
 * @Author: 焦质晔
 * @Date: 2019/6/20
 * @Last Modified by: 焦质晔
 * @Last Modified time: 2019-11-30 15:49:43
 */
import axios from '@/api/fetch';
import SERVER from '@/api/server';
import { getCompanyId } from '@/assets/js/auth';

// 未办理会员卡信息
export const getCardNotHandle = params => axios.get(`${SERVER.MEMBERS_CLUB}/management/handleService/getCardNotHandle`, { params });

// 保存会员卡信息
export const saveCardHandle = params => axios.post(`${SERVER.MEMBERS_CLUB}/management/handleService/saveCardHandle`, params);

// 会员办理
export const cardHandle = params => axios.get(`${SERVER.MEMBERS_CLUB}/management/handleService/cardHandle`, { params });

// 会员卡退办
export const retireCard = params => axios.get(`${SERVER.MEMBERS_CLUB}/management/handleService/retireCard`, { params });

// 选择入会推荐人
export const searchRecommender = params => axios.get(`${SERVER.MEMBERS_CLUB}/management/handleService/searchRecommender`, { params });

// 选择客户
export const getMemberInfo = params => axios.get(`${SERVER.DMSCLOUD_REPAIR}/memberInfo/getMemberInfo`, { params });

// 通过id获取会员卡信息
export const getCardNotHandleById = params => axios.get(`${SERVER.MEMBERS_CLUB}/management/handleService/getCardNotHandleById`, { params });

// 已办理会员卡信息
export const getCardHandle = params => axios.get(`${SERVER.MEMBERS_CLUB}/management/handleService/getCardHandle`, { params });

// 会员卡转账对方卡号
export const searchOtherCard = params => axios.get(`${SERVER.MEMBERS_CLUB}/management/handleService/searchOtherCard`, { params });

// 转账
export const saveTransAccounts = params => axios.post(`${SERVER.MEMBERS_CLUB}/management/handleService/saveTransAccounts`, params);

// 会员卡调整卡类别初始化
export const adjustClassInit = params => axios.get(`${SERVER.MEMBERS_CLUB}/management/handleService/adjustClassInit`, { params });

// 会员卡调整卡类别选择新卡号
export const searchNewCardNo = params => axios.get(`${SERVER.MEMBERS_CLUB}/management/handleService/searchNewCardNo`, { params });

// 会员卡调整卡类别
export const adjustCardClass = params => axios.post(`${SERVER.MEMBERS_CLUB}/management/handleService/adjustCardClass`, params);

// 会员卡批量调整卡类别
export const batchAdjustClass = params => axios.get(`${SERVER.MEMBERS_CLUB}/management/handleService/batchAdjustClass`, { params });

// 保存批量调整卡类别
export const saveBatchAdjust = params => axios.post(`${SERVER.MEMBERS_CLUB}/management/handleService/saveBatchAdjust`, params);

// 会员卡基础参数查询
export const doSearch = params => axios.post(`${SERVER.SYSMANAGE}/params/doSearch`, params);

// 会员卡会费管理初始化
export const memberFeeInit = params => axios.get(`${SERVER.MEMBERS_CLUB}/management/handleService/memberFeeInit`, { params });

// 会费缴纳
export const saveMemberFee = params => axios.post(`${SERVER.MEMBERS_CLUB}/management/handleService/saveMemberFee`, params);

// 联系人列表
export const getContactList = params => axios.get(`${SERVER.MEMBERS_CLUB}/management/handleService/searchCardContact`, { params });

// 删除联系人
export const removeContactRecord = params => axios.post(`${SERVER.MEMBERS_CLUB}/management/handleService/deleteContactById`, params);

// 保存联系人
export const saveContactInfo = params => axios.post(`${SERVER.MEMBERS_CLUB}/management/handleService/saveContact`, params);

// 获取积分项目 select
export const getIntegralProList = params => axios.get(`${SERVER.MEMBERS_CLUB}/basic/integral/getSelectionData`, { params });

// 调整积分 - 初始化接口
export const integralPointInitial = params => axios.get(`${SERVER.MEMBERS_CLUB}/management/handleService/integralInit`, { params });

// 保存调整积分
export const saveIntegralPoint = params => axios.post(`${SERVER.MEMBERS_CLUB}/management/handleService/saveAdjustIntegral`, params);

// 销售类型 select
export const getSalesType = params => axios.get(`${SERVER.MEMBERS_CLUB}/management/handleService/vehiclePointInit`, { params });

// 保存整车销售积分
export const saveVehicleIntegral = params => axios.post(`${SERVER.MEMBERS_CLUB}/management/handleService/saveVehiclePoint`, params);

// 获取整车销售积分列表
export const getVehicleIntegralList = params => axios.get(`${SERVER.MEMBERS_CLUB}/management/handleService/searchVehiclePoint`, { params });

// 获取优惠包搜索帮助列表
export const getYhbSHList = params => axios.get(`${SERVER.MEMBERS_CLUB}/management/discounts/searchByPage`, { params });

// 获取项目搜索帮助列表
export const getXmSHList = params => axios.get(`${SERVER.MEMBERS_CLUB}/management/handleService/chooseDiscountsItems`, { params });

// 获取兑换项目/备件列表
export const getProPartList = params => axios.get(`${SERVER.MEMBERS_CLUB}/management/handleService/searchDiscountsItems`, { params });

// 移除兑换项目/备件记录
export const removeProPartRecord = params => axios.post(`${SERVER.MEMBERS_CLUB}/management/handleService/deleteDiscountsItemById`, params);

// 获取卡类别优惠项目比例
export const getCardTypeBl = params => axios.get(`${SERVER.MEMBERS_CLUB}/basic/category/search`, { params });

// 保存积分兑换优惠包
export const saveProPartInfo = params => axios.post(`${SERVER.MEMBERS_CLUB}/management/handleService/saveExchangeDiscounts`, params);

// 获取代金券编号
export const getDjqSHList = params => axios.get(`${SERVER.MEMBERS_CLUB}/management/handleService/chooseVoucher`, { params });

// 获取代金券列表
export const getJfDjqList = params => axios.get(`${SERVER.MEMBERS_CLUB}/management/handleService/searchVoucher`, { params });

// 保存代金券
export const saveJfDjqInfo = params => axios.post(`${SERVER.MEMBERS_CLUB}/management/handleService/saveExchangeVoucher`, params);

// 获取积分清零/消减查询数据
export const searchIntegralCleaning = params => axios.get(`${SERVER.MEMBERS_CLUB}/management/handleService/searchIntegralCleaning`, { params });

// 保存积分清零的数据
export const saveIntegralZero = params => axios.post(`${SERVER.MEMBERS_CLUB}/management/handleService/saveIntegralZero`, params);

// 保存积分消减的数据
export const saveIntegralReduction = params => axios.post(`${SERVER.MEMBERS_CLUB}/management/handleService/saveIntegralReduction`, params);

// 获取主副卡管理数据
export const searchSubMangentInfo = params => axios.get(`${SERVER.MEMBERS_CLUB}/management/handleService/searchSubMangentInfo`, { params });

// 查询副卡数据
export const searchSubCard = params => axios.get(`${SERVER.MEMBERS_CLUB}/management/handleService/searchSubCard`, { params });

// 保存主副卡管理的数据
export const saveSubMangentInfo = params => axios.post(`${SERVER.MEMBERS_CLUB}/management/handleService/saveSubMangentInfo`, params);

// 删除副卡数据
export const deleteSubMangentInfo = params => axios.post(`${SERVER.MEMBERS_CLUB}/management/handleService/deleteSubMangentInfo`, params);

// 会员卡补卡查询新卡号
export const searchNewCard = params => axios.get(`${SERVER.MEMBERS_CLUB}/management/handleService/searchNewCard`, { params });

// 保存补卡数据
export const savePatchCard = params => axios.post(`${SERVER.MEMBERS_CLUB}/management/handleService/savePatchCard`, params);

// 人员获取
export const searchRoleByCode = params => {
  params.companyId = getCompanyId();
  return axios.get(`${SERVER.DMSCLOUD_BASEDATA}/basedata/users/getUserListByRole`, { params });
};

// 整车销售积分获取底盘号的搜索帮助
export const searchVehicleVins = params => axios.get(`${SERVER.MEMBERS_CLUB}/management/handleService/searchVehicleVins`, { params });

// 获取人员权限
export const staffAuthority = params => axios.get(`${SERVER.DMSCLOUD_BASEDATA}/basedata/users/getMembersByUserId`, { params });

// 省
export const getProvince = params => axios.get(`/api/basedata/region/listAllProvice`);

// 市
export const getCitys = provinceId => axios.get(`/api/basedata/region/listCityByProviceId/${provinceId}`);

// 查询会员联盟关系
export const getMembershipAlliance = params => axios.get(`${SERVER.MEMBERS_CLUB}/membersAlliance/getMembershipAlliance`, { params });
// 下载档案
export const downloadMemberDetail = params => axios.get(`${SERVER.MEMBERS_CLUB}/basic/category/downloadMemberDetail`, { params });

// 会员档案信息-车辆信息（下发)
export const downloadMemberInfo = params => axios.get(`${SERVER.MEMBERS_CLUB}/basic/category/downloadMemberInfo`, { params });
